package enemies.factory.builders;

import java.util.Random;

import modelLoader.ModelLoader;

import com.jme.scene.Node;

import enemies.strategy.concretes.ConcreteStrategyMed;
/**
 * Clase creadora de enemigos Altair 
 * @author Sebastian Giulietti 69032 
 * @author Adrian Sanchez 64251
 */

public class AltairEnemyBuilder extends EnemyBuilder {

	@Override
	public void asignarEstrategia() {
		getEnemy().setStrategy(new ConcreteStrategyMed(mapControl, getEnemy()));

	}

	@Override
	public void buildModel() {
		//Crear el modelo asignado 

		Node model = ModelLoader.getAltairModel();
		model.setLocalScale(.7f);
		model.setLocalTranslation(0, 2, 0);
		getEnemy().getNode().attachChild(model);

	}

	@Override	
	public void buildTexture() {
		
	}

	@Override
	//Posiciona a un Altair en la posicion aleatoria
	public void locate() {

		Random rnd = new Random();

		int row = rnd.nextInt(mapControl.getWide() - 5) + 5;
		int col = rnd.nextInt(mapControl.getHight() - 5) + 5;

		while (!mapControl.isEmpty(row, col)) {
			row = rnd.nextInt(mapControl.getWide());
			col = rnd.nextInt(mapControl.getHight());

		}

		getEnemy().locate(row, col);

	}

	@Override
	//Setea el nombre y puntaje
	public void setName() {
		getEnemy().setName("Altair");
		getEnemy().setScore(20);
	}
}